POV-Ray : Newsgroups : povray.newusers : texture mirroring (like D3DTADDRESS_MIRROR) : Re: texture mirroring (like D3DTADDRESS_MIRROR) Server Time
28 Jul 2024 18:15:50 EDT (-0400)
  Re: texture mirroring (like D3DTADDRESS_MIRROR)  
From: Alain
Date: 25 Oct 2007 11:44:48
Message: <4720b9f0@news.povray.org>
Nils nous apporta ses lumieres en ce 2007/10/25 10:30:
> Is there an easy way to get pov ray to mirror a texture every time it
> reaches a texture boundry?
> 
> 
> The default way pov ray repeats a texture is wrap, looks like this:
> http://www.math.uni-leipzig.de/pool/tuts/SelfDXD/DirectXGraphics/texturen/wrap.gif
> 
> The way I'd need the textures repeated should look like this:
> http://www.math.uni-leipzig.de/pool/tuts/SelfDXD/DirectXGraphics/texturen/mirror.gif
> 
> 
> 
> I've managed to simulate texture mirroring using the image_map 4 times
> (original, scaled by -1 in x, scaled in y and scaled in both x and y),
> combining these using gradient x and gradient y, but now I'm stuck.
> I can't interpolate my image_map (color leaks around the image borders) and
> scaling the image has become a nightmare.
> 
> So is there a convenient way to achive texture mirroring?
> 
> 
Very easy:
just use a warp{repeat x flip x}warp{repeat y flip y} scale Your_Scale
in your texture block.

The flip keyword in a repeat warp will cause the pattern to be inverted relative 
to a given axis.
In this case, it will repeat every unit along both x and y axis, and each 
repetition gets inverted relative to the preceding one.
You can now use interpolate, and scale after the warps.
Unless you scale it, your original image_map goes from x=0, y=0 to x=1, y=1, and 
extend infinitely along the z axis.
If you scale before the warps, you need to adjust the repeat values acording to 
the scaling that you used.

Please read the documentation about warp.

-- 
Alain
-------------------------------------------------
f u cn rd ths, u cn gt a gd jb n cmptr prgrmmng.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.